package com.example.controller;

import com.example.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LoginController {

    @RequestMapping("/login/{username}")
    @ResponseBody
    public String login(@PathVariable String username, @RequestParam String token, Model model){
        System.out.println("login-username:" + username);
        System.out.println("login-token:" + token);
        User user = (User) model.getAttribute("user");
        System.out.println("login-user:" + user);
        return "登录成功";
    }
}
